home *** CD-ROM | disk | FTP | other *** search
- /* Figlet.fse by Troels Walsted Hansen
- ** $VER: Figlet.fse v1.00 (21.11.94)
- **
- ** An ARexx script that asks you for a string and a figlet font,
- ** and then, using the figlet program, writes whatever string you
- ** entered, in the font you chose, into the editor.
- */
-
- /* some user variables. edit to your hearts content */
-
- figletprogpath = "Work:Figlet/"
- figletfontpath = "Work:Figlet/"
-
- /* needs FSE and THOR functions */
-
- options results
-
- if(substr(address(),1,8) ~= "THOR_FSE") then
- do
- say "This script should only be started from inside the FSE."
- exit 20
- end
- else fseport = address()
-
- p = ' ' || address() || ' ' || show('P',,)
- thorport = pos(' THOR.',p)
-
- if thorport > 0 then thorport = word(substr(p,thorport+1),1)
- else
- do
- say 'No THOR port found!'
- exit 10
- end
-
- /* get string */
-
- address(fseport)
- REQUESTSTRING TITLE '"Enter some text:"' BT '"_Ok|_Cancel"' MAXCHARS 999
- if(rc ~= 0) then exit
-
- figletstring = result
-
- /* get fontname */
-
- address(thorport)
- THORTOFRONT
-
- REQUESTFILE TITLE '"Select figlet font:"' ID '"'figletfontpath'"' FP PAT '"#?.flf"'
- if(rc ~= 0) then exit
-
- figletfont = result
- lastchar = right(figletfont,3)
-
- if(lastchar ~= "flf" | figletfont = "") then exit
-
- /* run figlet */
-
- call open(ofh, "T:figlet.fse.temp.file1", W)
- call writeln(ofh, figletstring)
- call close(ofh)
-
- address(fseport)
- LINELENGTH
- columnsnumber = result
-
- address command figletprogpath || 'figlet <T:figlet.fse.temp.file1 >T:figlet.fse.temp.file2 ' || delstr(figletfont, lastpos(".",figletfont)) || ' center columns ' || columnsnumber
-
- address(fseport)
- INCLUDEFILE "T:figlet.fse.temp.file2"
-
- /* cleanup and exit */
-
- if(exists("T:figlet.fse.temp.file1")) then address command 'delete >nil: "T:figlet.fse.temp.file1"'
- if(exists("T:figlet.fse.temp.file2")) then address command 'delete >nil: "T:figlet.fse.temp.file2"'
- exit
-